// pages/me/me.js
// pages/skillsApply/skillsApply.js
var app = getApp();
var  common= require('../../utils/common.js');
var Bmob = require('../../utils/bmob.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
  user_Info:''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var currentUser = Bmob.User.current();
    var that=this;
    console.log(currentUser)
    if (currentUser) {
      // do stuff with the userd
       console.log(currentUser)
    } else {
      
      var user = new Bmob.User(); //实例化用户对象
      user.auth().then(function (res) {
        var currentUser = Bmob.User.current()

        console.log(currentUser);
        console.log(res);})
     
      // show the signup or login page
    }
    that.setData({

      user_Info: currentUser
    })
  },
 
  onGotUserInfo: function (e) {
    var that=this;
    that.setData({

      user_Info: e.detail.userInfo
    })
    app.setmypic(e.detail.userInfo);
    console.log(e.detail.errMsg)
    console.log(e.detail.userInfo)
    console.log(e.detail.rawData)
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})